# Apache web server ***Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.*** --- The Apache Web Server (Apache HTTP Server) is an open-source, cross-platform web server software developed and maintained by the Apache Software Foundation. It is known for its stability, security, and high scalability, and supports a wide range of features through rich modules. It is one of the most widely used web servers in the world, commonly used for website hosting, dynamic application support, and reverse proxy scenarios. This document describes how to install and run the **Apache Web Server** on the Quectel Pi M2 Debian system and access the web page from a Windows computer on the same local area network. # Prerequisites 1. Confirm the device environment: - The Quectel Pi M2 and Windows host are on the same local area network with working network connectivity between both sides - If you plan to install Apache online via `apt`, the device must also be able to access Debian software repositories 2. Check network connectivity: - Run `hostname -I` in the device terminal to view the current IP address, then `ping` the Windows host or gateway address on the same network segment; if you see returned time information, LAN communication is working normally. You can also run `ping ` on the Windows host to confirm. 3. Log in to the development board: - You can log in via serial console or graphical interface; the default user is `q`. # Install Apache Web Service Apache is one of the most commonly used web server programs for providing website access services. 1. Update the software repositories: ```bash sudo apt update ``` 2. Install the Apache service: ```bash sudo apt install apache2 -y ``` > 💡 If the current network cannot access Debian software repositories, you can also download the `apache2`, `apache2-data`, `apache2-utils` and other architecture-matching packages on the host first, then copy them to the device for offline installation. 3. Confirm that Apache is installed successfully: ```bash /usr/sbin/apache2 -v ``` # Start and Enable Autostart 1. Start the Apache service: ```bash sudo systemctl start apache2 ``` 2. Set it to start automatically on boot: ```bash sudo systemctl enable apache2 ``` 3. Check the running status: ```bash sudo systemctl status apache2 systemctl is-active apache2 systemctl is-enabled apache2 ``` # Allow the Web Access Port If the device firewall has restricted port `80`, you need to add a rule to allow it. The following example allows a specific Windows host to access the device's HTTP service. Replace `` with the actual IP: ```bash sudo iptables -I INPUT 1 -i eth0 -p tcp -s --dport 80 -j ACCEPT ``` Check port listening and firewall rules: ```bash ss -tulnp | grep ':80' sudo iptables -S INPUT | grep 80 ``` Testing confirms that Apache is listening on `0.0.0.0:80` or `:::80`. For actual access, use the device's current IP address obtained from `hostname -I`. # View the Device IP Address ```bash hostname -I ``` # Test Apache Installation 1. Access the following URL in a browser on a computer within the same local area network: ``` http:/// ``` 2. If everything is working normally, you will see the Apache default page. # Change the Default Web Page The default web page of Apache is an HTML file in the file system, located at `/var/www/html/index.html`. Navigate to this directory and view the contents: ```bash cd /var/www/html ls -al ``` The following content will be displayed: ``` total 20 drwxr-xr-x 2 root root 4096 Oct 30 07:53 . drwxr-xr-x 3 root root 4096 Oct 30 06:51 .. -rw-r--r-- 1 root root 10703 Oct 30 06:51 index.html ``` By default, the system has a web page file named `index.html` in the `/var/www/html` directory, owned by the `root` user. Since regular users cannot directly modify files owned by root, if you need to edit this web page, you must change its owner to your own username. - **Default user q**: ```bash sudo chown q:q index.html ``` - **Other custom user**: ```bash sudo chown : index.html ``` Now you can edit this file. After modification, simply refresh the browser to view the changes to the web page. # Troubleshooting | **Symptom** | **Possible Cause** | **Solution** | | --- | --- | --- | | Windows Command Prompt reports `Test-NetConnection` is not recognized as an internal or external command | `Test-NetConnection` is a PowerShell command, not a CMD command | Open Windows PowerShell and re-run `Test-NetConnection -Port 80` | | `AH00558` warning appears in Apache status | Apache global `ServerName` is not configured; this is a common warning | Does not affect web page access; to eliminate the warning, set `ServerName` in the Apache configuration | | Can `ping` the device but browser cannot open the web page, and `TcpTestSucceeded` is `False` | Apache service is not running, port 80 is not listening, or the device firewall has not allowed port 80 | On the device, run `sudo systemctl status apache2`, `sudo systemctl restart apache2`, `ss -tulnp \| grep ':80'` in sequence to confirm service status and port listening | | `apt install apache2` cannot complete | The device's current network cannot access Debian software repositories | First confirm that the development board has internet access; if only LAN is available, download `apache2` related packages on the host and copy them to the development board for offline installation (see the note in the installation section) | | IP address is correct but still cannot access | The device and Windows host are not on the same LAN, or the IP address changed after switching ADB/Ethernet | Run `hostname -I` on the device to re-confirm the IP address and ensure that the Windows host and device are on the same network segment | If you confirm that Apache is listening on `0.0.0.0:80` but Windows still cannot access it, you can temporarily allow the Windows host to access port 80 (replace `` with the actual IP): ```bash sudo iptables -I INPUT 1 -i eth0 -p tcp -s --dport 80 -j ACCEPT ```